package com.x.ioc_02;

import org.springframework.beans.factory.annotation.Configurable;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * ClassName: JavaBean
 * Package: IntelliJ IDEA
 * Description:
 * Written by HanXu
 * Create 2024.09.03 0:01
 */

@Component
@Scope(scopeName = ConfigurableBeanFactory.SCOPE_PROTOTYPE) //多例
public class JavaBean {

    @PostConstruct //初始化方法
    public void init(){
        System.out.println("JavaBean init");
    }


    @PreDestroy //销毁方法
    public void destroy(){
        System.out.println("JavaBean destroy");
    }
}
